import { Dept } from '../../api/Dept';
import { Room } from '../../api/Room';
import { Card } from '../base/Card';

export class BlackMarket extends Card {
	title(room: Room, user: string): string {
		return '倒卖军饷';
	}

	desc(room: Room, user: string): string {
		return `+${this.money(room)}铜钱，+1腐败。`;
	}

	money(room: Room) {
		var dept = room.getDept('bing');
		if (!dept) return 0;
		return Math.floor(dept.getDeptDataValue('military') / 5);
	}

	use(room: Room, user: string, target: string): void {
		var dept = room.getDept(user);
		if (!dept) return;
		dept.addDeptDataValue('money', this.money(room));
		dept.addDeptDataValue('corrupt', 1);
	}

	target(room: Room, user: string): string {
		return 'this';
	}
}
